﻿@using NB.MGJ.Model
@{
    Layout = null;
    Sys_Role role = ViewBag.Role as Sys_Role;
}
<style>
    .tittle-bg {
        background-color: #E8F2F7;
    }
</style>


<form id="form_EditRole" role="form" onkeydown="if(event.keyCode==13){return false;}">
    <div>

        <!-- Tab panes -->
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane active" id="basicInfo">
                <div class="row" style="margin-top:15px;">
                    <input type="hidden" value="@role.EnterpriseId" name="EnterpriseId" />
                    <div class="col-xs-2 col-md-2 text-right">
                        角色名称：
                    </div>
                    <div class="col-xs-10 col-md-10">
                        <input type="text" class="form-control" autocomplete="off" placeholder="请输入角色名称" id="RoleName$value" name="RoleName" value="@role.RoleName" maxlength="20">
                        <input type="hidden" value="@role.ID" name="ID" id="rid" />
                    </div>
                </div>
                @*<div class="row">
                        <div class="col-xs-2 col-md-2 text-right">
                            所属机构：
                        </div>
                        <div class="col-xs-10 col-sm-10 col-md-10 col-lg-10">
                            @Html.DropDownList("EnterpriseId", null, new { @class = "form-control" })
                        </div>
                    </div>*@


                <div>

                </div>

                <div class="row">
                    <div class="col-xs-2 col-md-2 text-right">
                        备注：
                    </div>
                    <div class="col-xs-10 col-md-10">
                        <textarea class="form-control" id="Remark$value" name="Remark">@role.Remark</textarea>
                    </div>
                </div>

            </div>

        </div>

    </div>

</form>
@*<script>
    $(function () {

        //加载树形表格
        $.MGJ.RoleManage.Ajax_GetTableTree($("#rid").val());
        //绑定已有权限  勾上复选框
        $.MGJ.RoleManage.Ajax_GetRoleTree($("#rid").val());
    });

    $(document.body).on("click", ".TwoLevelMEnu", function (e) {
        if ($(".glyphicon-minus-sign").length > 0) {
            $(".glyphicon-minus-sign").removeClass("glyphicon-minus-sign").addClass("glyphicon-plus-sign")
        }
        $(this).find(".glyphicon").removeClass("glyphicon-plus-sign").addClass("glyphicon-minus-sign")

        $(".LayerRow").hide()
        if ($(this).find(".LayerRow").length == 0) {
            var $label = '<label class="col-xs-6 col-sm-6 col-md-6 col-lg-6"><input type="checkbox" value="' + 111 + '" />' + 111 + '</label>'
            var $LayerRowStart = '<div onclick="event.cancelBubble = true" class="LayerRow"  style="border:2px solid #e4eaec;width:200px;height:auto;position:absolute;z-index:1051;background:#FFFFFF;padding-top:5px">'
            var $LayerRowOver = '<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12" style="border-top: 1px solid #e4eaec;padding:5px"><label class="col-xs-4 col-sm-4 col-md-4 col-lg-4"><input type="checkbox" value="111" class="AllClick"  />全选  </label><button type="button" class="btn btn-sm btn-primary pull-right LayerT" style="margin-left:5px">确定</button><button type="button"  class="btn btn-sm pull-right LayerF">取消</button></div></div>'
            var $LayerRow = $LayerRowStart + $label + $label + $label + $label + $LayerRowOver
            $(this).append($LayerRow)
        } else {
            $(this).find(".LayerRow").show()
        }
        e.stopPropagation();
    }).on("change", ".AllClick", function () {
        if (this.checked) {
            $(this).parents(".LayerRow").find("input").prop("checked", true);
        } else {
            $(this).parents(".LayerRow").find("input").prop("checked", false);
        }
    }).on("mousedown", ".LayerT", function () {
        $(this).parents(".LayerRow").hide().parents(".TwoLevelMEnu").find(".glyphicon").removeClass("glyphicon-minus-sign").addClass("glyphicon-plus-sign")
    }).on("mouseup", ".LayerF", function () {
        $(this).parents(".TwoLevelMEnu").find(".glyphicon").removeClass("glyphicon-minus-sign").addClass("glyphicon-plus-sign")
        $(this).parents(".LayerRow").remove();
    })
</script>*@


<script>

    $(function () {
        $('#form_EditRole').bootstrapValidator({
            group: '.col-xs-10.col-md-10',
            fields: {
                RoleName: {
                    validators: {
                        notEmpty: {
                            message: '角色名称不能为空'
                        },
                        stringLength: {
                            max: 20,
                            message: '角色名称最大长度为20'
                        },
                        regexp: {
                            regexp: /^[a-zA-Z\u4e00-\u9fa5]+$/,
                            message: '角色名称不能输入符号和数字'
                        }
                    }
                }
            }
        });
    })
</script>
